package net.lovesrc.allin;

public class Message {

    private final String retcode;

    private final Object data;

    private final String message;

    public Message(String retcode, Object data, String message) {
        super();
        this.retcode = retcode;
        this.data = data;
        this.message = message;
    }

    public String getRetcode() {
        return retcode;
    }

    public Object getData() {
        return data;
    }

    public String getMessage() {
        return message;
    }

    public boolean isSuccess() {
        return "OK".equalsIgnoreCase(retcode);
    }

    public static Message success() {
        return new Message("OK", null, null);
    }

    public static Message success(Object data) {
        return new Message("OK", data, null);
    }

    public static Message failure(String retcode, String message) {
        return new Message(retcode, null, message);
    }

}


